package main

func searchMatrix(matrix [][]int, target int) bool {
	row, cell := 0, len(matrix[0])-1

	for row < len(matrix) && cell >= 0 {
		if matrix[row][cell] == target {
			return true
		}

		if matrix[row][cell] > target {
			cell--
		} else {
			row++
		}
	}

	return false
}
